//
//  AllotOrderCell.m
//  HAODE
//
//  Created by panquanReabam.com on 16/5/25.
//  Copyright © 2016年 reabam.com. All rights reserved.
//

#import "AllotOrderCell.h"

@interface AllotOrderCell()
@property(nonatomic,strong)UILabel *itemTypes;
@property(nonatomic,strong)UILabel *itemTypesLabel;
@property(nonatomic,strong)UILabel *memberName;
@property(nonatomic,strong)UILabel *memberNameLabel;
@property(nonatomic,strong)UILabel *source;
@property(nonatomic,strong)UILabel *sourceLabel;
@property(nonatomic,strong)UILabel *createDate;
@property(nonatomic,strong)UILabel *createDateLabel;
@property(nonatomic,strong)UILabel *NoLabel;
@property(nonatomic,strong)UILabel *totalMoney;
@property(nonatomic,strong)UILabel *totalMoneyLabel;
@property(nonatomic,strong)UILabel *depositLabel;
@property(nonatomic,strong)UILabel *lineLabel;
@property(nonatomic,strong)UILabel *state1;
@property(nonatomic,strong)UILabel *state2;
@property(nonatomic,strong)UILabel *state3;
@end
@implementation AllotOrderCell

- (void)awakeFromNib {
    
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self createView];
        [self setViewAutoLayout];
    }
    return self;
}
-(void)createView
{
    self.backgroundColor=[UIColor whiteColor];
    self.NoLabel=[[UILabel alloc] init];
    self.NoLabel.font= [UIFont systemFontOfSize:17];
    self.NoLabel.textColor=[UIColor colorWithRed:0/255.0f green:0/255.0f blue:0/255.0f alpha:1.0];
    [self addSubview:self.NoLabel];
    self.state1=[[UILabel alloc] init];
    self.state1.font= [UIFont systemFontOfSize:13];
    self.state1.textAlignment=NSTextAlignmentCenter;
    [self addSubview:self.state1];
    self.state2=[[UILabel alloc] init];
    self.state2.font= [UIFont systemFontOfSize:13];
    [self addSubview:self.state2];
    self.state3=[[UILabel alloc] init];
    self.state3.font= [UIFont systemFontOfSize:13];
    [self addSubview:self.state3];
    self.memberName=[[UILabel alloc] init];
    self.memberName.font= [UIFont systemFontOfSize:14];
    self.memberName.text=@"会员";
    self.memberName.textColor=zhonghuiColor;
    [self addSubview:self.memberName];
    self.memberNameLabel=[[UILabel alloc] init];
    self.memberNameLabel.font= [UIFont systemFontOfSize:14];
    self.memberNameLabel.textColor=shenhuiColor;
    [self addSubview:self.memberNameLabel];
    self.source=[[UILabel alloc] init];
    self.source.font= [UIFont systemFontOfSize:14];
    self.source.text=@"来源";
    self.source.textColor=zhonghuiColor;
    [self addSubview:self.source];
    self.sourceLabel=[[UILabel alloc] init];
    self.sourceLabel.font= [UIFont systemFontOfSize:14];
    self.sourceLabel.textColor=shenhuiColor;
    [self addSubview:self.sourceLabel];
    self.createDate=[[UILabel alloc] init];
    self.createDate.font= [UIFont systemFontOfSize:14];
    self.createDate.text=@"时间";
    self.createDate.textColor=zhonghuiColor;
    [self addSubview:self.createDate];
    self.createDateLabel=[[UILabel alloc] init];
    self.createDateLabel.font= [UIFont systemFontOfSize:14];
    self.createDateLabel.textColor=shenhuiColor;
    [self addSubview:self.createDateLabel];
    self.itemTypes=[[UILabel alloc] init];
    self.itemTypes.font= [UIFont systemFontOfSize:14];
    self.itemTypes.textColor=zhonghuiColor;
    [self addSubview:self.itemTypes];
    self.itemTypesLabel=[[UILabel alloc] init];
    self.itemTypesLabel.font= [UIFont systemFontOfSize:14];
    self.itemTypesLabel.textColor=shenhuiColor;
    [self addSubview:self.itemTypesLabel];
    self.totalMoney=[[UILabel alloc] init];
    self.totalMoney.font= [UIFont systemFontOfSize:14];
    self.totalMoney.text=@"金额 ¥";
    self.totalMoney.textColor=zhonghuiColor;
    [self addSubview:self.totalMoney];
    self.totalMoneyLabel=[[UILabel alloc] init];
    self.totalMoneyLabel.font= [UIFont systemFontOfSize:14];
    self.totalMoneyLabel.textColor=qianheiColor;
    [self addSubview:self.totalMoneyLabel];
    
    self.depositLabel=[[UILabel alloc] init];
    self.depositLabel.font= [UIFont systemFontOfSize:14];
    self.depositLabel.textColor=shenhuiColor;
    [self addSubview:self.depositLabel];
    
    self.lineLabel=[[UILabel alloc] initWithFrame:CGRectMake(10, 123.6, ScreenWidth-20, 0.35)];
    [self.lineLabel setBackgroundColor:qianhuiColor];
    self.lineLabel.textColor=[UIColor clearColor];
    [self addSubview:self.lineLabel];
}
-(void)setGoodsInOrderListModel:(GoodsInOrderListModel *)GoodsInOrderListModel{
    
    
    
    
    
    if ([GoodsInOrderListModel.status isEqualToString:@"NA"]) {
        self.state1.textColor=shenhongseColor;
    }else if ([GoodsInOrderListModel.status isEqualToString:@"YR"]) {
        self.state1.textColor=shenhongseColor;
        
    }else if ([GoodsInOrderListModel.status isEqualToString:@"YC"]) {
        self.state1.textColor=shenhuiColor;
    }else if ([GoodsInOrderListModel.status isEqualToString:@"YI"]) {
        self.state1.textColor=luseColor;
        
    }else if ([GoodsInOrderListModel.status isEqualToString:@"YB"]) {
        self.state1.textColor=[UIColor colorWithRed:253/255.0 green:152/255.0 blue:39/255.0 alpha:1];
    }
    
    else{
        
        self.state1.textColor=luseColor;
    }
    
    
    self.state1.text=[NSString stringWithFormat:@"%@",  GoodsInOrderListModel.statusName];
    
    self.NoLabel.text=[NSString stringWithFormat:@"%@", GoodsInOrderListModel.orderNo];
       
    self.memberName.text=[NSString stringWithFormat:@"%@",@"员工"];
    
    self.memberNameLabel.text=[NSString stringWithFormat:@"%@",GoodsInOrderListModel.createName];
//    NSRange range={0,16};
    NSString* string =GoodsInOrderListModel.createDate;
    
    
    self.source.text=[NSString stringWithFormat:@"%@",@"供应商"];
    self.sourceLabel.text=[NSString stringWithFormat:@"%@",GoodsInOrderListModel.supplierName];
    
    self.createDate.text=@"时间";
    self.createDateLabel.text=[NSString stringWithFormat:@"%@",string];
    
    self.itemTypes.text=@"商品";
    self.itemTypesLabel.text=[NSString stringWithFormat:@"%@%@件",GoodsInOrderListModel.itemTypes,GoodsInOrderListModel.totalQuantity];
    
    
    self.totalMoney.text=@"金额￥";
    
    self.totalMoneyLabel.text=[NSString stringWithFormat:@"%.2f",GoodsInOrderListModel.totalMoney.doubleValue];
    
    
}



-(void)setAllotOrderListModel:(AllotOrderListModel *)AllotOrderListModel{
    
    if ([AllotOrderListModel.allotType isEqualToString:@"转出"]) {
        self.state1.textColor=[UIColor whiteColor];
        self.state1.backgroundColor=[UIColor colorWithRed:252/255.0 green:102/255.0 blue:33/255.0 alpha:1];
        self.state1.text=[NSString stringWithFormat:@"%@ " ,AllotOrderListModel.allotType];
        self.state1.font=[UIFont systemFontOfSize:11];
        self.source.text=[NSString stringWithFormat:@"%@",@"到仓库"];
        self.sourceLabel.text=[NSString stringWithFormat:@"%@",AllotOrderListModel.inWhsName];
        
    }else{
        self.state1.textColor=[UIColor whiteColor];
        self.state1.backgroundColor=luseColor;
        self.state1.font=[UIFont systemFontOfSize:11];
        self.state1.text=[NSString stringWithFormat:@"%@ " ,AllotOrderListModel.allotType];
        self.source.text=[NSString stringWithFormat:@"%@",@"从仓库"];
        self.sourceLabel.text=[NSString stringWithFormat:@"%@",AllotOrderListModel.outWhsName];
        
    }
    
    
    
    if ([AllotOrderListModel.status isEqualToString:@"NA"]) {
        self.state2.textColor=shenhongseColor;
    }else
        if ([AllotOrderListModel.status isEqualToString:@"YR"]) {
            self.state2.textColor=shenhongseColor;
        }else{
            
            self.state2.textColor=luseColor;
        }
    
    
    self.state2.text=[NSString stringWithFormat:@"%@",  AllotOrderListModel.statusName];
    
    self.NoLabel.text=[NSString stringWithFormat:@"%@", AllotOrderListModel.orderNo];
   
    
    self.memberName.text=[NSString stringWithFormat:@"%@",@"员工"];
    
    self.memberNameLabel.text=[NSString stringWithFormat:@"%@",AllotOrderListModel.createName];
//    NSRange range={0,16};
    NSString* string =AllotOrderListModel.createDate ;
    
    
    
    
    self.createDate.text=@"时间";
    self.createDateLabel.text=[NSString stringWithFormat:@"%@",string];
    
    self.itemTypes.text=@"商品";
   
    self.itemTypesLabel.text=[NSString stringWithFormat:@"%@%@件",AllotOrderListModel.itemTypes,AllotOrderListModel.totalQuantity];

    
    self.totalMoney.text=@"金额￥";
    
    self.totalMoneyLabel.text=[NSString stringWithFormat:@"%@",AllotOrderListModel.totalMoney];
    
    
    
}

-(void)setViewAutoLayout
{
    [self.NoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).with.offset(15) ;
        make.height.equalTo(@17);
        make.top.equalTo(self.mas_top).with.offset(24);
    }];
    
    [self.state1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.NoLabel.mas_right).with.offset(7.5);
        make.height.equalTo(@13);
        
        make.centerY.equalTo(self.NoLabel.mas_centerY) ;
    }];
    [self.state2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.state1.mas_right).with.offset(5);
        make.height.equalTo(@13);
        
        make.centerY.equalTo(self.NoLabel.mas_centerY) ;
    }];
    [self.state3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.state2.mas_right).with.offset(5);
        make.height.equalTo(@13);
        
        make.centerY.equalTo(self.NoLabel.mas_centerY) ;
    }];
    [self.memberName mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.mas_left).with.offset(15) ;
        make.height.equalTo(@14);
        make.top.equalTo(self.NoLabel.mas_bottom).with.offset(14);
    }];
    
    [self.memberNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.memberName.mas_right).with.offset(3);
        make.height.equalTo(@14);
        
        make.centerY.equalTo(self.memberName.mas_centerY) ;
        
    }];
    
    
    [self.source mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.memberNameLabel.mas_right).with.offset(15) ;
        make.height.equalTo(@14);
        make.centerY.equalTo(self.memberName.mas_centerY) ;
    }];
    
    [self.sourceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.source.mas_right).with.offset(3);
        make.height.equalTo(@14);
        
        make.centerY.equalTo(self.memberName.mas_centerY) ;
        
    }];
    [self.createDate mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.mas_left).with.offset(15) ;
        
        make.height.equalTo(@14);
        
        make.top.equalTo(self.memberName.mas_bottom).with.offset(3);
    }];
    
    [self.createDateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.createDate.mas_right).with.offset(3);
        make.height.equalTo(@14);
        
        make.top.equalTo(self.memberName.mas_bottom).with.offset(3);
        
    }];
    
    
    [self.itemTypes mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.mas_left).with.offset(15) ;
        make.height.equalTo(@14);
        make.top.equalTo(self.createDate.mas_bottom).with.offset(3);

    }];
    
    [self.itemTypesLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.itemTypes.mas_right).with.offset(3);
        make.height.equalTo(@14);
        make.centerY.equalTo(self.itemTypes.mas_centerY) ;
        
    }];
    [self.totalMoney mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.itemTypesLabel.mas_right).with.offset(15) ;
        make.height.equalTo(@14);
        make.centerY.equalTo(self.itemTypes.mas_centerY) ;
        
    }];
    
    [self.totalMoneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.totalMoney.mas_right).with.offset(3);
        make.height.equalTo(@14);
        make.centerY.equalTo(self.itemTypes.mas_centerY) ;
        
    }];
    [self.depositLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.totalMoneyLabel.mas_right).with.offset(15);
        make.height.equalTo(@14);
        make.centerY.equalTo(self.itemTypes.mas_centerY) ;
        
    }];
//    [self.lineLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.equalTo(self.mas_left).with.offset(10);
//        make.right.equalTo(self.mas_right).with.offset(-10) ;
//        make.height.equalTo(@0.5);
//        make.top.equalTo(self.mas_top).with.offset(108.5);
//    }];
    
    
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end
